﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace blackhouse.Translator.Business {
    internal class ComputedTranslatorResourceManager : ITranslatorResourceManager {

        #region Fields

        private List<ITranslatorResourceManager> managers = new List<ITranslatorResourceManager>();

        #endregion

        #region Methods

        internal void Add(ITranslatorResourceManager manager) {
            this.managers.Add(manager);
        }

        public ITranslatorResource[] GetResources() {
            List<ITranslatorResource> resources = new List<ITranslatorResource>();
            foreach (ITranslatorResourceManager manager in this.managers) {
                resources.AddRange(manager.GetResources());
            }
            return resources.OrderBy(r => r.Name).ToArray();
        }

        #endregion

    }
}
